<?php
class SchoolModel extends RelationModel{
	/*
	 *定义关联关系 
	 */
	public $_link=array(
		'tweets'=>array(
			'mapping_type'=>HAS_MANY,
			'class_name'=>'Tweets',
			'foreign_key'=>'school_id',
		),
		
		'location'=>array(
			'mapping_type'=> MANY_TO_MANY,
			'class_name'=> 'location',
			'foreign_key'=>'school_id',
			'relation_foreign_key'=>'location_id',
			'relation_table'=>'agl_school_location',
		),
		
		'user'=>array(
			'mapping_type'=>HAS_MANY,
			'class_name'=>'user',
			'foreign_key'=>'school_id',
		),
	);
	
	/*
	 * 表单数据验证 
	 */
	protected $_validate=array(
		array('school_name','require','请填写学校名称!'),
	);
	
	/*
	 * 数据自动完成 
	 */

	/*
	 * 表单项与字段的映射
	 */

}
?>
